package com.itstyle.seckill.common.designPattern.zhuangtai;

public class Switcher {
    private State state = new Off();

    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    public void switchOn(){
        state.switchOn(this);
    }

    public void switchOff(){
        state.switchOff(this);
    }

    public static void main(String[] args) {
        Switcher switcher = new Switcher();
        switcher.switchOn();
        switcher.switchOn();
        switcher.switchOff();
    }
}
